import { post, get } from "../utlis/http.js"

export const modeling = {
  //添加工单
  addModelProject (param, type) {
    if (type == "新增") {
      return post(`/modelProject/add`, param)
    } else {
      return post(`/modelProject/modify`, param) //修改
    }
  },
  modifyModelStatus (param) {
    return post(`/modelProject/modifyStatus`, param)
  },
  //查询列表
  modelProjectList (param) {
    if (param.field) {
      return post(`/modelProject/list?page=${param.page}&size=${param.size}&sort=${param.field},${param.order}`, param)
    } else {
      return post(`/modelProject/list?page=${param.page}&size=${param.size}`, param)
    }
  },
  //删除工单
  removeModelProject (id) {
    return post(`/modelProject/remove`, { fid: id })
  },

  //获取因素列表
  getFactorList (param) {
    return post(`/modelConfig/list?page=${param.page}&size=${param.size}&sort=${param.field},${param.order}`, param)
  },

  modifyFactorList (param) {
    return post(`/modelConfig/modifys`, param)
  },

  toAnalysis (param) {
    return post(`/modelConfig/toAnalysis`, param)
  },

  //查询当前选中列表数据
  modelResultFind (id) {
    return get(`/modelResult/find/${id}`)
  },

  //查询列表
  modelResultList (param) {
    if (param.field) {
      return post(`/modelResult/list?page=${param.page}&size=${param.size}&sort=${param.field},${param.order}`, param)
    } else {
      return post(`/modelResult/list?page=${param.page}&size=${param.size}`, param)
    }
  },

  genRecipe (param) {
    return post(`/modelResult/genRecipe`, param)
  }

  // //修改工单状态
  // modifyStatus (param) {
  //   return post(`/ModelProject/modifyStatus`, param)
  // },
  // //校验工单是否重复
  // ModelProjectCheck (param) {
  //   return post(`/ModelProject/check`, param)
  // },
  // //验证批次号是否重复
  // checkLot (param) {
  //   return post(`/ModelProject/checkLot`, param)
  // }
}

